package com.ostrich.eyepelizer

import android.content.ComponentName
import android.content.pm.PackageManager
import com.alibaba.android.arouter.launcher.ARouter
import com.ostrich.library_base.BaseApplication
import com.ostrich.library_common.utils.LoggerUtils

/**
 * @Author : yaotianxue
 * @Time : On 2023/10/23 11:21
 * @Description : App
 *
 *
 *
 * 打包：
 * 1。代码混淆：包名、类名、方法名、变量名 abcd
 * 2。签名：
 */
class App:BaseApplication() {
    override fun onCreate() {
        super.onCreate()
        //获得application信息
        val appInfo = packageManager.getApplicationInfo(packageName, PackageManager.GET_META_DATA)
        val metaData = appInfo.metaData
        LoggerUtils.d("App",metaData.getString("test").toString())

        //获得activity信息
        val activityInfo = packageManager.getActivityInfo(ComponentName(this,
            "com.ostrich.module_main.ui.MainActivity"), PackageManager.GET_META_DATA)
        val metaData2 = activityInfo.metaData
        LoggerUtils.d("App",metaData2.getString("test2").toString())
        //获得当前app的版本号和版本名称：提示用户是否需要升级app
        val packageInfo = packageManager.getPackageInfo(packageName, 0)
        LoggerUtils.d("App","versionCode：${packageInfo.versionCode} versionName:${packageInfo.versionName}")

    }

}